package py.com.alfa.escriba.web.rest.secure;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import py.com.alfa.escriba.exception.ServiceException;
import py.com.alfa.escriba.persistence.dto.ControlesDTO;
import py.com.alfa.escriba.persistence.dto.ControlesEscriturasDTO;
import py.com.alfa.escriba.persistence.dto.ControlesFormulariosInfoDTO;
import py.com.alfa.escriba.persistence.dto.ControlesInfoDTO;
import py.com.alfa.escriba.persistence.dto.ControlestextoDTO;
import py.com.alfa.escriba.persistence.dto.query.ControlesQueryDTO;
import py.com.alfa.escriba.persistence.dto.query.ControlesRequestDTO;
import py.com.alfa.escriba.web.rest.EscribaService;
import py.com.alfa.escriba.web.rest.dto.GenerateEscrituraDTO;

@Path(EscribaService.SECURE_PATH + "/controles")
public interface ControlesSecureRESTService {

  @GET
  @Produces(MediaType.APPLICATION_JSON)
  List<ControlesDTO> listControles(@Context HttpServletRequest request) throws ServiceException;

  @Path("/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  ControlesInfoDTO showControl(@PathParam("id") Long id, @Context HttpServletRequest request) throws ServiceException;

  @Path("/{id}")
  @PUT
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  ControlesInfoDTO saveControl(@PathParam("id") Long id, ControlesInfoDTO dto, @Context HttpServletRequest request) throws ServiceException;

  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  ControlesInfoDTO createControl(ControlesInfoDTO dto, @Context HttpServletRequest request) throws ServiceException;

  @Path("/{id}")
  @DELETE
  Response deleteControl(@PathParam("id") Long id, @Context HttpServletRequest request) throws ServiceException;
  
  @Path("/listRequestControles")
  @POST
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  List<ControlesRequestDTO> listRequestControles(ControlesQueryDTO dto, @Context HttpServletRequest request) throws ServiceException;
  
  @Path("/formularios/getByIdControl/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  List<ControlesFormulariosInfoDTO> getControlesFormulariosByIdControl(@PathParam("id") Long idControl, @Context HttpServletRequest request) throws ServiceException;
  
  @Path("/formularios/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  ControlesFormulariosInfoDTO getControlesFormulariosById(@PathParam("id") Long id, @Context HttpServletRequest request) throws ServiceException;
  
  @Path("/formularios/{id}")
  @PUT
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  ControlesInfoDTO saveControlesFormularios(@PathParam("id") Long idControl, ControlesInfoDTO dto, @Context HttpServletRequest request) throws ServiceException;

  @Path("/escrituras/byIdControl/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  List<ControlesEscriturasDTO> getControlesEscriturasByIdControl(@PathParam("id") Long idControl,@Context HttpServletRequest request) throws ServiceException;  
  
  @Path("/escrituras/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  ControlesEscriturasDTO showControlesEscritura(@PathParam("id") Long id, @Context HttpServletRequest request) throws ServiceException;

  @Path("/escrituras/{id}")
  @PUT
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  ControlesInfoDTO saveControlesEscrituras(@PathParam("id") Long idControl, ControlesInfoDTO dto, @Context HttpServletRequest request) throws ServiceException;

  @Path("/generarescritura/{idCtrl}/{idTemplate}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  GenerateEscrituraDTO generateEscrituras(@PathParam("idCtrl") Long idControl, @PathParam("idTemplate") Long idTemplate, @Context HttpServletRequest request) throws ServiceException;
  
  @Path("/textos/byIdControl/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  ControlestextoDTO getControlesTextoByIdControl(@PathParam("id") Long idControl,@Context HttpServletRequest request) throws ServiceException;  
  
  @Path("/textos/{id}")
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  ControlestextoDTO showControlesTexto(@PathParam("id") Long id, @Context HttpServletRequest request) throws ServiceException;

  @Path("/textos/{id}")
  @PUT
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  ControlesInfoDTO saveControlesTexto(@PathParam("id") Long idControl, ControlesInfoDTO dto, @Context HttpServletRequest request) throws ServiceException;

}